// 轮播图1
var mySwiper = new Swiper('.swiper', {
    // 默认的切换设置。
    autoplay: {
        delay: 2000,
        stopOnLastSlide: false,
        disableOnInteraction: false,
    },
    // 循环(loop)模式
    loop: true,
    // 前进后退

    navigation: {
        nextEl: '.swiper-button-next',
        prevEl: '.swiper-button-prev',
    },
    // 切换器
    pagination: {
        el: '.swiper-pagination',
        clickable: true,
    },
})
// 鼠标移入轮播停止
$('.swiper').addEventListener('mouseover', function () {
    mySwiper.autoplay.stop()
})
$('.swiper').addEventListener('mouseout', function () {
    mySwiper.autoplay.start()
})


// // 轮播图2
let comSwiper = new Swiper('.swipe', {
    autoplay: {
        delay: 2000,
        stopOnLastSlide: false,
        disableOnInteraction: false,
    },
    loop: true, // 循环模式选项
    effect: 'fade',//渐变
})


// ATI鼠标移入切换背景和图片
let imgSrc = ['api01-c.svg', 'api01-c.svg', 'api03-c.svg', 'api04-c.svg', 'api05-c.svg', 'api06-c.svg', 'api07-c.svg', 'api08-c.svg', 'apic1-c.svg', 'apic2-c.svg']
let imgSrc2 = ['api01.svg', 'api01.svg', 'api03.svg', 'api04.svg', 'api05.svg', 'api06.svg', 'api07.svg', 'api08.svg', 'apic1.svg', 'apic2.svg']
$a('.APIItem li').forEach(function (v, i) {
    v.addEventListener('mouseover', function () {
        // console.log(1);
        v.children[0].src = `../../assets/images/${imgSrc[i]}`
        v.style.backgroundColor = 'rgb(47 126 233)'

    })
    v.addEventListener('mouseout', function () {
        // console.log(1);
        v.children[0].src = `../../assets/images/${imgSrc2[i]}`
        v.style.backgroundColor = ''
    })
});

// 回到顶部
window.addEventListener('scroll', function () {
    if (window.scrollY >= 400) {
        $('.toTobBtn').style.display = 'block'
    } else {
        $('.toTobBtn').style.display = 'none'
    }
})
$('.toTobBtn').addEventListener('click', function () {
    window.scrollTo({
        top: 0,
        left: 0,
        behavior: 'smooth'
    })
})



